﻿//-----------------------------------------------------------------------
// <copyright file="Program.cs" company="DylanBox">
// Copyright (c) DylanBox Corporation. All rights reserved.
// </copyright>
// <summary>
//      Sample of refactoring, Version 1.0.0.3
//      
//      Refactoring 3: 
//          using "Replace Temp with Query" to remove temp variable
//          temp variables will make program difficult to be understanded, particularly in complex and long function, they're not easy to be tracked.
//          Obviously, this perhaps degrade performance, but it is worth doing . Performance can be optimizated later with clear coding infrastruture.
//      
//      In this sample, we should replace variable "currentAmout" with "rental.GetCharge()"
// </summary>
// <reference>
//    <<Refactoring: Improving the design of existing code>>
// </reference>
// <author>Dylan</author>
//-----------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace RentalCalcV3
{
    class Program
    {
        static void Main(string[] args)
        {
            Customer dylan = new Customer("Dylan");

            dylan.AddRental(
                new Rental
                {
                    RentedMovie = new Movie { Title = "Gone with wind", PriceCode = Movie.WAR },
                    DaysRented = 3
                }
                );

            dylan.AddRental(
                new Rental
                {
                    RentedMovie = new Movie{ Title = "Cubic", PriceCode = Movie.EMOTION },
                    DaysRented = 2
                }
                );

            Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Name + ":\t" + Assembly.GetExecutingAssembly().GetName().Version);
            Console.WriteLine(dylan.Statement());
            Console.Read();            
        }
    }
}
